<h2 class="new-admin-subtitle"><span>New Package</span></h2>
<%= render :partial => "admin/shared/global_errors.html" -%>
<p class="information">The new package will be available to be used as material in all pipelines. Other admins might be able to edit this package.</p>
<%- if scope[:package_configuration] %>
    <div class="new_form_item_block">
        <div class="new_form_label required">
            <%= label_tag "", required_label_text("Package Name") %>
        </div>
        <div class="new_form_control">
            <%= text_field_tag "material[package_definition[name]]", scope[:package_configuration].name %>
        </div>
    </div>
    <%- scope[:package_configuration].properties.each_with_index do |property, index| %>
        <div class="new_form_item">
            <%- if property.is_mandatory -%>
                <div class="new_form_label required">
                    <%= label_tag "", required_label_text(property.display_name) %>
                </div>
            <%- else -%>
                <div class="new_form_label">
                    <%= label_tag "", property.display_name %>
                </div>
            <%- end -%>

            <%= hidden_field_tag "material[package_definition[configuration][#{index}][configurationKey][name]]", property.name %>
            <div class="new_form_control">
                <% if property.is_secure %>
                    <%= password_field_tag "material[package_definition[configuration][#{index}][configurationValue][value]]", property.value %>
                    <%= hidden_field_tag "material[package_definition[configuration][#{index}][isChanged]]", true %>
                <% else %>
                    <%= text_field_tag "material[package_definition[configuration][#{index}][configurationValue][value]]", property.value %>
                <% end %>
            </div>
        </div>
    <%- end %>
    <div class="new_form_item">
        <div class="new_form_label"></div>
        <div class="new_form_control">
            <%= render :partial => 'admin/package_definitions/check_package' %>
        </div>
    </div>
<%- end %>
